import Mock from 'mockjs'

const top = [{
  label: '首页',
  path: '',
  icon: 'el-icon-menu',
  meta: {
    i18n: '',
  },
  menuLevel: 1
},
{
  label: '接口调试',
  icon: 'el-icon-document',
  meta: {
    i18n: 'website',
  },
  path: 'http://127.0.0.1:8008/doc.html',
  menuLevel: 2
},
{
  label: 'avuex官网',
  icon: 'el-icon-document',
  meta: {
    i18n: 'avuexwebsite',
  },
  path: 'https://avuex.avue.top',
  menuLevel: 3
},
{
  label: '测试',
  icon: 'el-icon-document',
  path: '/test/index',
  meta: {
    i18n: 'test',
  },
  menuLevel: 4
}]
const menuData={
  'code':200,
  'success':true,
  'data':[
    {
      'id':1,
      'parentId':0,
      'code':'desk',
      'name':'工作台',
      'alias':'menu',
      'path':'/desk',
      'source':'iconfont iconicon_airplay',
      'sort':1,
      'category':1,
      'action':0,
      'isOpen':1,
      'remark':'',
      'isDeleted':0,
      'children':[
        {
          'id':2,
          'parentId':1,
          'code':'notice',
          'name':'通知公告1',
          'alias':'menu',
          'path':'/desk/notice',
          'source':'iconfont iconicon_sms',
          'sort':1,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':'',
          'meta': {
            'i18n': 'cache',
            'keepAlive': true
          },
        }
      ],
      'parentName':'',
      'categoryName':'',
      'actionName':'',
      'isOpenName':''
    },
    {
      'id':3,
      'parentId':0,
      'code':'system',
      'name':'系统管理',
      'alias':'menu',
      'path':'/system',
      'source':'iconfont iconicon_setting',
      'sort':2,
      'category':1,
      'action':0,
      'isOpen':1,
      'remark':'',
      'isDeleted':0,
      'children':[
        {
          'id':4,
          'parentId':3,
          'code':'user',
          'name':'用户管理',
          'alias':'menu',
          'path':'/user',
          'source':'iconfont iconicon_principal',
          'sort':1,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':'',
          'meta': {
            'i18n': 'cache',
            'keepAlive': true
          },
          'children':[
            {
              'id':4,
              'parentId':3,
              'code':'user',
              'name':'系统用户管理',
              'alias':'menu',
              'path':'/system/sysUserInfo',
              'source':'iconfont iconicon_principal',
              'sort':1,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':'',
              'meta': {
                'i18n': 'cache',
                'keepAlive': false
              },
            },
            {
              'id':4,
              'parentId':3,
              'code':'user',
              'name':'用户组管理',
              'alias':'menu',
              'path':'/system/sysGroupInfo',
              'source':'iconfont iconicon_principal',
              'sort':1,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':'',
              'meta': {
                'i18n': 'cache',
                'keepAlive': false
              },
            },
            {
              'id':4,
              'parentId':3,
              'code':'user',
              'name':'用户组用户管理',
              'alias':'menu',
              'path':'/system/sysGroupUserRelation',
              'source':'iconfont iconicon_principal',
              'sort':1,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':'',
              'meta': {
                'i18n': 'cache',
                'keepAlive': false
              },
            },
            {
              'id':4,
              'parentId':3,
              'code':'orguser',
              'name':'其他组织用户',
              'alias':'org_user',
              'path':'/system/sysOrgUserRelation',
              'source':'iconfont iconicon_principal',
              'sort':1,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':'',
              'meta': {
                'i18n': 'cache',
                'keepAlive': false
              },
            }
          ]
        }, 
       
        {
          'id':7,
          'parentId':3,
          'code':'menu',
          'name':'组织架构管理',
          'alias':'menu',
          'path':'/system/sysOrgInfo',
          'source':'iconfont iconicon_subordinate',
          'sort':4,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        },
        {
          'id':8,
          'parentId':3,
          'code':'role',
          'name':'租户管理',
          'alias':'menu',
          'path':'/system/sysTenantInfo',
          'source':'iconfont iconicon_boss',
          'sort':5,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        },
        {
          'id':9,
          'parentId':3,
          'code':'role',
          'name':'角色管理',
          'alias':'menu',
          'path':'/system/sysRole',
          'source':'iconfont iconicon_community_line',
          'sort':6,
          'category':1,
          'action':1,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':'',
          'meta': {
            'i18n': 'cache',
            'keepAlive': false
          },
        },
        {
          'id':61,
          'parentId':3,
          'code':'client',
          'name':'菜单管理',
          'alias':'menu',
          'path':'/system/sysMenu',
          'source':'iconfont iconicon_mobilephone',
          'sort':8,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':'',
          'meta': {
            'i18n': 'cache',
            'keepAlive': false
          },
        },
        {
          'id':61,
          'parentId':3,
          'code':'api',
          'name':'接口管理',
          'alias':'menu',
          'path':'/system/sysApiScope',
          'source':'el-icon-star-off',
          'sort':8,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':'',
          'meta': {
            'i18n': 'cache',
            'keepAlive': false
          },
        }
      ],
      'parentName':'',
      'categoryName':'',
      'actionName':'',
      'isOpenName':''
    },
    {
      'id':10,
      'parentId':0,
      'code':'monitor',
      'name':'系统监控',
      'alias':'menu',
      'path':'/monitor',
      'source':'iconfont icon-yanzhengma',
      'sort':3,
      'category':1,
      'action':0,
      'isOpen':1,
      'remark':'',
      'isDeleted':0,
      'children':[
        {
          'id':11,
          'parentId':10,
          'code':'doc',
          'name':'接口文档',
          'alias':'menu',
          'path':'http://localhost/doc.html',
          'source':'iconfont iconicon_study',
          'sort':1,
          'category':1,
          'action':0,
          'isOpen':2,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        },
        {
          'id':12,
          'parentId':10,
          'code':'admin',
          'name':'服务治理',
          'alias':'menu',
          'path':'http://localhost:7002',
          'source':'iconfont icon-canshu',
          'sort':2,
          'category':1,
          'action':0,
          'isOpen':2,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        },
        {
          'id':13,
          'parentId':10,
          'code':'log',
          'name':'日志管理',
          'alias':'menu',
          'path':'/monitor/log',
          'source':'iconfont iconicon_doc',
          'sort':3,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'children':[
            {
              'id':14,
              'parentId':13,
              'code':'log_usual',
              'name':'通用日志',
              'alias':'menu',
              'path':'/monitor/log/usual',
              'source':'',
              'sort':1,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':''
            },
            {
              'id':15,
              'parentId':13,
              'code':'log_api',
              'name':'接口日志',
              'alias':'menu',
              'path':'/monitor/log/api',
              'source':'',
              'sort':2,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':''
            },
            {
              'id':16,
              'parentId':13,
              'code':'log_error',
              'name':'错误日志',
              'alias':'menu',
              'path':'/monitor/log/error',
              'source':'',
              'sort':3,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':''
            }
          ],
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        }
      ],
      'parentName':'',
      'categoryName':'',
      'actionName':'',
      'isOpenName':''
    },
    {
      'id':17,
      'parentId':0,
      'code':'tool',
      'name':'研发工具',
      'alias':'menu',
      'path':'/tool',
      'source':'iconfont icon-wxbgongju',
      'sort':4,
      'category':1,
      'action':0,
      'isOpen':1,
      'remark':'',
      'isDeleted':0,
      'children':[
        {
          'id':13,
          'parentId':10,
          'code':'log',
          'name':'数据标准',
          'alias':'menu',
          'path':'/tool/dict',
          'source':'iconfont iconicon_doc',
          'sort':3,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'children':[
            {
              'id':14,
              'parentId':13,
              'code':'dict_root',
              'name':'词根管理',
              'alias':'menu',
              'path':'/tool/dict/sysToolDictRoot',
              'source':'',
              'sort':1,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':''
            },
            {
              'id':15,
              'parentId':13,
              'code':'dict_attr',
              'name':'定语管理',
              'alias':'menu',
              'path':'/tool/dict/sysToolDictAttr',
              'source':'',
              'sort':2,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':''
            },
            {
              'id':16,
              'parentId':13,
              'code':'dict_field',
              'name':'变量管理',
              'alias':'menu',
              'path':'/tool/dict/sysToolDictField',
              'source':'',
              'sort':3,
              'category':1,
              'action':0,
              'isOpen':1,
              'remark':'',
              'isDeleted':0,
              'parentName':'',
              'categoryName':'',
              'actionName':'',
              'isOpenName':''
            }
          ],
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        },
        {
          'id':18,
          'parentId':17,
          'code':'code',
          'name':'数据库表定义',
          'alias':'menu',
          'path':'/tool/sysTables',
          'source':'iconfont iconicon_savememo',
          'sort':1,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':'',
          'meta': {
            'keepAlive': false
          },
        },
        {
          'id':66,
          'parentId':17,
          'code':'datasource',
          'name':'动态表单定义',
          'alias':'menu',
          'path':'/platform/sysDynamicForm',
          'source':'iconfont icon-caidanguanli',
          'sort':2,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        },
        {
          'id':66,
          'parentId':17,
          'code':'datasource',
          'name':'动态表单示例',
          'alias':'menu',
          'path':'/tool/activeForms',
          'source':'iconfont icon-caidanguanli',
          'sort':2,
          'category':1,
          'action':0,
          'isOpen':1,
          'remark':'',
          'isDeleted':0,
          'parentName':'',
          'categoryName':'',
          'actionName':'',
          'isOpenName':''
        }
      ],
      'parentName':'',
      'categoryName':'',
      'actionName':'',
      'isOpenName':''
    }
  ],
  'msg':'操作成功'
}
export default ({mock}) => {
  if (!mock) return;
  Mock.mock('/user/getTopMenu', 'get', (res) => {
    return {
      data: top
    }
  })
  Mock.mock('/user/getMenu', 'get', (res) => {
    let body = JSON.parse(res.body);
    console.log('body====');
    return {
      data: menuData.data
    }
  })
}